/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upeu.modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;

/**
 *
 * @author pc
 */
@Entity
@Table(name = "CURSO")
@NamedQueries({
    @NamedQuery(name = "Curso.findAll", query = "SELECT c FROM Curso c")})
public class Curso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CURSO_ID")
    private String cursoId;
    @Basic(optional = false)
    @Column(name = "NOMBRE")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "CREDITOS")
    private short creditos;
    @Basic(optional = false)
    @Column(name = "HORA_AC")
    private short horaAc;
    @Basic(optional = false)
    @Column(name = "ESTADO")
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cursoId")
    private Collection<Asistencia> asistenciaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cursoId")
    private Collection<Cargadocente> cargadocenteCollection;

    public Curso() {
    }

    public Curso(String cursoId) {
        this.cursoId = cursoId;
    }

    public Curso(String cursoId, String nombre, short creditos, short horaAc, String estado) {
        this.cursoId = cursoId;
        this.nombre = nombre;
        this.creditos = creditos;
        this.horaAc = horaAc;
        this.estado = estado;
    }

    public String getCursoId() {
        return cursoId;
    }

    public void setCursoId(String cursoId) {
        this.cursoId = cursoId;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public short getCreditos() {
        return creditos;
    }

    public void setCreditos(short creditos) {
        this.creditos = creditos;
    }

    public short getHoraAc() {
        return horaAc;
    }

    public void setHoraAc(short horaAc) {
        this.horaAc = horaAc;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Collection<Asistencia> getAsistenciaCollection() {
        return asistenciaCollection;
    }

    public void setAsistenciaCollection(Collection<Asistencia> asistenciaCollection) {
        this.asistenciaCollection = asistenciaCollection;
    }

    public Collection<Cargadocente> getCargadocenteCollection() {
        return cargadocenteCollection;
    }

    public void setCargadocenteCollection(Collection<Cargadocente> cargadocenteCollection) {
        this.cargadocenteCollection = cargadocenteCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cursoId != null ? cursoId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Curso)) {
            return false;
        }
        Curso other = (Curso) object;
        if ((this.cursoId == null && other.cursoId != null) || (this.cursoId != null && !this.cursoId.equals(other.cursoId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upeu.modelo.Curso[ cursoId=" + cursoId + " ]";
    }
    
}
